import http from "@/http/index.ts"
import {Quote, QuoteForm, QuoteListParam, QuoteProductUpdateDto} from '@/api/quote/type.ts'


// 新增报价单
export const addApi = (data: QuoteForm) => {
    return http.post("/quote/createQuote", data)
}


// 分页条件查询列表
export const getListApi = (data:QuoteListParam) => {
    return http.get("/quote/getQuoteList",data)
}

// 根据产品的id查询产品的bom详情信息
export const getDetailByIdApi = (id:number) => {
    return http.get(`/quote/quoteDetailById/${id}`,)
}


// 编辑
export const editApi = (data: QuoteForm) => {
    return http.put("/quote/updateQuote", data)
}

// 删除
export const deleteApi = (id: number) => {
    return http.delete(`/quote/deleteQuote/${id}`)
}


// 自动生成报价单单号
export const getQuoteNumberApi = () => {
    return http.get("/quote/getQuoteNumber")
}

// 报价单组成部分结构
export const getQuoteStructApi = (quoteId:string,code:string) => {
    return http.get(`/quote/getQuoteStruct/${quoteId}/${code}`)
}

// 修改报价单组成部分结构
export const updateQuoteStructApi = (data: QuoteProductUpdateDto) => {
    return http.put("/quote/updateQuoteItemPrice", data)
}
